<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .red{
      background:red;
    }
    .green{
      background: green;
    }
    .black{
      background: #000;
    }
    .yellow{
      background: yellowgreen;
    }
  </style>
</head>
<body>
  <div id="app">
    <lxbutton>Login</lxbutton>
    <lxbutton type="danger">Login</lxbutton> 
    <lxbutton type="success">Login</lxbutton> 
    <lxbutton type="warn">Login</lxbutton> 
    <lxbutton type="warn">Login</lxbutton> 
  </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
  Vue.component('lxbutton',{
    props:{
      type:{
        type:String,
        default:'defaults',
        validator(val){
          console.log(val)
          return ['success','danger','warn','defaults'].includes(val)
        }
      }
    },
    template:`
      <button :class="{black: type == 'defaults', red: type == 'danger', green: type == 'success', yellow:type == 'warn'}">
        <slot></slot>
      </button>
    `
  })
  new Vue({
    el:'#app',
    data() {
      return {
        
      }
    },
  })
</script>
</html>